﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Epic.Expressions.NetFramework
{
    public static class StringExtensions
    {
        public static string EscapeFormatString(this string s)
        {
            if (string.IsNullOrWhiteSpace(s))
                return s;

            var sb = new StringBuilder(s.Length);
            foreach (var c in s)
            {
                switch (c)
                {
                    case '{':
                    case '}':
                        sb.Append(c);
                        break;
                }
                sb.Append(c);
            }
            return sb.ToString();
        }
    }
}
